<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Login - jQuery EasyUI</title>
    <link rel="stylesheet" type="text/css" href="themes/black/easyui.css">
    <link rel="stylesheet" type="text/css" href="themes/mobile.css">
    <link rel="stylesheet" type="text/css" href="themes/icon.css">
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.easyui.min.js"></script>
    <script type="text/javascript" src="jquery.easyui.mobile.js"></script>
</head>
<body>
<div class="easyui-navpanel" style="position:relative">
    <div id="dlg" class="easyui-dialog" style="padding:20px 6px;width:25%;" data-options="inline:true,modal:true,closed:true,title:'统一权限登录平台'">
        <div style="margin-bottom:10px">
            <input id="username" value="caiwl" class="easyui-textbox" prompt="用户名" style="width:100%;height:30px" data-options="iconCls:'icon-man'">
        </div>
        <div>
            <input id="password" value="13579" class="easyui-passwordbox" prompt="密码" style="width:100%;height:30px">
        </div>
        <div class="dialog-button">
            <a href="javascript:void(0)" class="easyui-linkbutton" style="width:100%;height:35px" onclick="submit()">登录</a>
        </div>
    </div>
</div>
<script>
    function submit() {
        var username = $('#username').val();
        var password = $('#password').val();
        if (username.length <= 0 || password.length <= 0) {
            $.messager.alert('提示', '用户名和密码为空！');
            return;
        }
        if (username != 'caiwl' || password != '13579') {
            $.messager.alert('提示', '用户名或密码错误！');
            return;
        }

        // 设置全局登录token
        sessionStorage.setItem('token', '1357924680');

        $.messager.alert('提示', '登录成功，跳转中...');
        setTimeout(function() {
            window.location.href = 'plugins/jquery-easyui-desktop/desktop.html';
        }, 2000);
    }

    $(function() {
        $('#dlg').dialog('open').dialog('center');
    });
</script>
</body>
</html>